﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VietThuongLMS.Utils;
//Author: Kha
namespace VietThuongLMS.ViewModels
{
    public class ChuongTrinhKhuyenMaiViewModel
    {
        public List<ChuongTrinhKhuyenMai> List { get; set; }
        public int Total { get; set; }

        public List<ChuongTrinhKhuyenMaiMoRongModel> ListMoRong { get; set; }
        public int TotalMoRong { get; set; }

        public ChuongTrinhKhuyenMaiViewModel()
        {
            this.List = new List<ChuongTrinhKhuyenMai>();
            this.Total = 0;
            this.ListMoRong = new List<ChuongTrinhKhuyenMaiMoRongModel>();
            this.TotalMoRong = 0;
        }

        public ChuongTrinhKhuyenMaiViewModel(List<ChuongTrinhKhuyenMai> list, int total)
        {
            this.List = list;
            this.Total = total;
        }

        public ChuongTrinhKhuyenMaiViewModel(List<ChuongTrinhKhuyenMaiMoRongModel> list, int total)
        {
            this.ListMoRong = list;
            this.TotalMoRong = total;
        }

        public void TinhHocPhiSauKhiGiam()
        {
            Converter cter = new Converter();
            foreach (ChuongTrinhKhuyenMaiMoRongModel ctkmmr in ListMoRong)
            {
                ctkmmr.HocPhiSauKhiGiam = cter.GetStringMonney((double.Parse(ctkmmr.HocPhiGoc) * (100-(double)ctkmmr.CTKM.GiamGia) / 100).ToString()) ;
                ctkmmr.HocPhiGoc = cter.GetStringMonney(ctkmmr.HocPhiGoc);
            }
        }
    }

    public class ChuongTrinhKhuyenMaiMoRongModel
    {
        public ChuongTrinhKhuyenMai CTKM { get; set; }

        public string TenLoaiLopHoc { get; set; }
        public string HocPhiGoc { get; set; }
        public string HocPhiSauKhiGiam { get; set;}
        public string ThoiLuong { get; set; }
        public string MoTa { get; set; }

        public ChuongTrinhKhuyenMaiMoRongModel()
        {
            CTKM = new ChuongTrinhKhuyenMai();
            HocPhiSauKhiGiam = "";
        }
    }
}